<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="__CATCH_ADMIN_IMAGES__/favicon.ico" rel="icon">
    <title>CatchAdmin 后台管理系统</title>
    <link rel="stylesheet" href="__CATCH_ADMIN_LIBS__/layui/css/layui.css"/>
    <link rel="stylesheet" href="__CATCH_ADMIN_MODULE__/admin.css?v=315"/>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <!-- 头部 -->
    <div class="layui-header">
        <div class="layui-logo">
            <img src="__CATCH_ADMIN_IMAGES__/logo.png"/>
            <cite>CatchAdmin</cite>
        </div>
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="flexible" title="侧边伸缩"><i class="layui-icon layui-icon-shrink-right"></i></a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="refresh" title="刷新"><i class="layui-icon layui-icon-refresh-3"></i></a>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <!--  <li class="layui-nav-item" lay-unselect>
                 <a ew-event="message" title="消息">
                     <i class="layui-icon layui-icon-notice"></i>
                     <span class="layui-badge-dot"></span>
                 </a>
             </li>
            <li class="layui-nav-item" lay-unselect>
                 <a ew-event="note" title="便签"><i class="layui-icon layui-icon-note"></i></a>
             </li>-->
            <li class="layui-nav-item layui-hide-xs" lay-unselect>
                <a ew-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a>
                    <img src="__CATCH_ADMIN_IMAGES__/head.png" class="layui-nav-img">
                    <cite>{$username}</cite>
                </a>
                <dl class="layui-nav-child">
                    <!--<dd lay-unselect>
                        <a ew-href="javascript:;">个人中心</a>
                    </dd>
                    <dd lay-unselect>
                        <a ew-event="psw">修改密码</a>
                    </dd>
                    <hr>-->
                    <dd lay-unselect>
                        <a id="logout">退出</a>
                    </dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="theme" title="主题"><i class="layui-icon layui-icon-more-vertical"></i></a>
            </li>
        </ul>
    </div>

    <!-- 侧边栏 -->
    <div class="layui-side">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree arrow2" lay-filter="admin-side-nav" lay-accordion="true"
                style="margin-top: 15px;">
                {foreach $menus as $key => $menu }
                    <li class="layui-nav-item">
                        {if (!empty($menu['children']))}
                            <a><i class="layui-icon layui-icon-home"></i>&emsp;<cite>{$menu['permission_name']}</cite></a>
                            <dl class="layui-nav-child">
                            {foreach $menu['children'] as $m}
                                {if (!empty($m['children']))}
                                    <a><i class="layui-icon layui-icon-home"></i>&emsp;<cite>{$m['permission_name']}</cite></a>
                                    <dl class="layui-nav-child">
                                    {foreach $m['children'] as $_m}
                                        <dd><a lay-href="{:url($_m['route'])}">{$_m['permission_name']}</a></dd>
                                    {/foreach}
                                    </dl>
                                {else/}
                                    <dd><a lay-href="{:url($m['route'])}">{$m['permission_name']}</a></dd>
                                {/if}
                            {/foreach}
                            </dl>
                        {else/}
                        <a lay-href="{:url($menu['route'])}"><i class="layui-icon layui-icon-unlink"></i>&emsp;<cite>{$menu['permission_name']}</cite></a>
                        {/if}
                    </li>
                {/foreach}
            </ul>
        </div>
    </div>

    <!-- 主体部分 -->
    <div class="layui-body"></div>
    <!-- 底部 -->
    <div class="layui-footer">
        copyright 2017 ~ © {:date('Y', time())} <a href="https://catchadmin.com" target="_blank">catchadmin.com</a> all rights reserved.
        <span class="pull-right">Version 2.0</span>
    </div>
</div>

<!-- 加载动画 -->
<div class="page-loading">
    <div class="ball-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>

<!-- js部分 -->
<script type="text/javascript" src="__CATCH_ADMIN_LIBS__/layui/layui.js"></script>
<script type="text/javascript" src="__CATCH_ADMIN_JS__/common.js?v=315"></script>
<script>
    layui.use(['index', 'admin'], function () {
        var $ = layui.jquery;
        var index = layui.index;
        var admin = layui.admin;

        // 默认加载主页
        index.loadHome({
            menuPath: '{:url("dashboard")}',
            menuName: '<i class="layui-icon layui-icon-home"></i>'
        });
        $(document).on('click','#logout',function(){
            admin.req('{:url("logout")}', {}, function (response) {
                if (response.code === 10000) {
                    window.location.href = "{:url('login')}";
                }
            }, 'post')
        });
    });

</script>
</body>
</html>